package com.eusoft.grades.school;
/**
 * @author Nick Eubanks
 * 
 * Copyright (C) 2010 Android Infinity (http://www.androidinfinity.com)
 *
 */
import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @author Nick Eubanks
 */
public class Item implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3298018082285999644L;
	public Date dateDue = new Date();
	public String ID = "", description = "", notes = "";

	public boolean isComplete = false;

	private int isGraded;

	public double pointsEarned = 0;

	public double pointsPossible = 0;

	/** Returns grade in terms of percent */
	public double calculateGrade() {
		if (this.pointsPossible == 0 && this.pointsEarned == 0)
			return 0;
		else if (this.pointsPossible == 0)
			return this.pointsEarned;
		else
			return ((pointsEarned / pointsPossible) * 100);
	}
	public double getExtraCreditValue() {
		return this.pointsEarned;
	}

	public boolean isGraded() {
		if (isGraded == 1)
			return true;
		else if (isGraded == 0)
			return isComplete;
		else if (isGraded == 2)
			return false;
		else
			return isComplete;
	}

	public void setGraded(boolean graded) {
		if (graded)
			isGraded = 1;
		else
			isGraded = 2;
	}

}
